import {curlStore} from '@/stores/framework/curl'

const COLUMNS = [
    {field: "code", title: "渠道编号", width: "120px", align: "left"},
    {field: "name", title: "渠道名称", width: "220px", align: "left"},
    {field: "startTime", title: "有效期（开始）", width: '220px'},
    {field: "endTime", title: "有效期（结束）", width: '220px'},
    {field: "tenantDomain", title: "域名"},
    {field: "status", title: "状态"},
    {field: "createTime", title: "创建时间"},
]

const SEARCH_FORM = [{field: "name", title: "渠道名称"}]

const OPTIONS = [
    {title: "个性化", emit: "view"},
    {title: "修改", emit: "modify"},
    {title: "删除", emit: "remove"},
]

const API = {
    LIST: "/tenant/page",
    SAVE: "/tenant",
    MODIFY: {method: "put", api: "/tenant"},
    REMOVE: {method: "delete", api: "/tenant"},
    INFO: "/tenant/details"
}

const store = {
    state(){
    },

    actions:{
        /**
         * 调用详情接口
         * @param id
         * @returns {Promise<*>}
         */
        async getInfo(id) {
            let {data} = await Http.get(API.INFO + "/" + id);
            return data;
        },
    }
}

const useStore = curlStore("tenant", COLUMNS, OPTIONS, SEARCH_FORM, API, store)
export default useStore
